<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.vsg.stock.basic.domain.mybatis.VolFigureKlineDailyProxy">


	<resultMap id="VolFigureKlineDailyResult" type="org.vsg.stock.basic.domain.mybatis.VolFigureKlineDailyProxy">
		<id property="id.codeVolFigureDetails" column="code_vol_figure_details" />
		<id property="id.stockCode" column="stock_code" />
		<id property="id.stockStartDate" column="stock_date_start" />
		<result property="stockDateEnd" column="stock_date_end"/>
	</resultMap>


	<select id="findVolFiguKlineDailyInCycleByStck"  
		resultMap="VolFigureKlineDailyResult" 
		parameterType="map"
		>
    	select 
    		STOCK_CODE , STOCK_DATE_START , STOCK_DATE_END, CODE_VOL_FIGURE_DETAILS
    	from VOL_FIGURE_KLINE_DAILY 
    	where 
    		STOCK_CODE = #{stockCode} and CODE_VOL_FIGURE_DETAILS = #{codeVolFigureDetails}
    		and STOCK_DATE_START &gt;= #{stockStartDate} and STOCK_DATE_START &lt;= #{stockDateEnd}
  	</select>

	<select id="findVolFiguKlineDaily"  
		resultMap="VolFigureKlineDailyResult" 
		parameterType="map"
		>
    	select 
    		STOCK_CODE , STOCK_DATE_START , STOCK_DATE_END, CODE_VOL_FIGURE_DETAILS
    	from VOL_FIGURE_KLINE_DAILY 
    	where 
    		STOCK_CODE = #{stockCode} and CODE_VOL_FIGURE_DETAILS = #{codeVolFigureDetails}
    	order by STOCK_DATE_END
  	</select>


	<select id="findVolFiguKlineDailyByCharacterPrepared_stockCode"  
		resultMap="VolFigureKlineDailyResult" 
		parameterType="map"
		>
	select 
		v1.stock_code,
		v1.stock_date_start,
		v1.stock_date_end as STOCK_DATE_END,
		v1.code_vol_figure_details AS code_vol_figure_details 
	from vol_figure_kline_daily as v1 
	inner join vol_character_prepared b on v1.code_vol_figure_details = b.vol_figure_details_code
	where v1.stock_code=#{stockCode} order by v1.stock_date_start
  	</select>

</mapper>
